package data;

import com.alibaba.fastjson.JSON;
import com.tc.data.test.entity.Tc;
import com.tc.data.test.service.TcService;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.util.List;

/**
 * gradle5 如果依赖其他jar，可能导致test加载不到 main 内的 class 编译出错 妈的
 */

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath:spring-split-data.xml" }, inheritLocations = true)
@Slf4j
public class test {
    @Autowired
    private TcService tcService;
    @Test
    public void demo(){
        List<Tc> all = tcService.findAll("2");
        log.info(JSON.toJSONString(all));
    }

    @Test
    public void demo1(){
        List<Tc> all = tcService.findAllBySplitTable("");
        log.info(JSON.toJSONString(all));
    }
}
